<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun1(){
					var temp=document.createElement("div");
					temp.innerHTML="div的文字";
					// innerHTML修改文本内容
					document.getElementById("con").appendChild(temp)
						// setAttribute增加属性
					temp.setAttribute("style","color:red");
			}
			function fun2(){
					var temp=document.createElement("img");
					// 增加属性
					temp.setAttribute("src","img/off.png");
					temp.setAttribute("width","100px");
					document.getElementById("con").appendChild(temp)
			}
			
		</script>
	</head>
	<body>
		<button onclick="fun1()">添加文本</button>
		<button onclick="fun2()">添加图片</button>
		<div id="con"><!-- div做容器 -->
			
		</div>
	</body>
</html>
